package cn.bdqn.controller;

import cn.bdqn.pojo.VehicleComplaints;
import cn.bdqn.service.VehicleComplaintsService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/veh")
public class VehicleComplaintsController {
    @Resource
    VehicleComplaintsService vehicleComplaintsService;

    @RequestMapping("/list")
    public String list(@RequestParam(defaultValue = "0") Integer brandId, Model model){
        List<VehicleComplaints> lists = vehicleComplaintsService.selectAll((long)brandId);
        model.addAttribute("vc",lists);
        model.addAttribute("brandId",brandId);
        return "index";
    }

    @RequestMapping("/add")
    public String add(@RequestParam(defaultValue = "0") Integer brandId, Model model){
        return "add";
    }
}
